<?php
$userName = $_GET['userName'];
$userType = $_GET['userType'];
$errors = $_GET['errorMsg'];
$errorMsg = array(
    "1" => "Please enter a username!",
    "2" => "Password and Confirm Password fields must match, please re-enter!",
    "3" => "Please select a valid user type!",
    "4" => "Username already exists, please select an alternate!",
    "5" => "Password cannot be empty!"
);
$displayError = array();
$errorArray = explode ( ",", $errors );
foreach($errorArray as $element) {
    $displayError[] = $errorMsg[$element];

}
 ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Create Account</title>
<link rel="stylesheet" type="text/css" href="view.css" media="all">
<script type="text/javascript" src="view.js"></script>

</head>
<body id="main_body" >
	
	<img id="top" src="top.png" alt="">
	<div id="form_container">
	
		<h1><a>Create Account</a></h1>
		<form id="form_528101" class="appnitro"  method="post" action="create_account_action.php">
					<div class="form_description">
			<h2>Create Account</h2>
			<p class="error"><?= join("<br/>",$displayError) ?></p>
		</div>						
			<ul >
			
					<li id="li_1" >
		<label class="description" for="userName">Username </label>
		<div>
			<input id="userName" name="userName" class="element text medium" type="text" maxlength="255" value="<?= $userName ?>"/>
		</div> 
		</li>		<li id="li_2" >
		<label class="description" for="password">Password </label>
		<div>
			<input id="password" name="password" class="element text medium" type="password" maxlength="255" value=""/>
		</div> 
		</li>		<li id="li_3" >
		<label class="description" for="confirmPassword">Confirm Password </label>
		<div>
			<input id="confirmPassword" name="confirmPassword" class="element text medium" type="password" maxlength="255" value=""/>
		</div> 
		</li>		<li id="li_4" >
		<label class="description" for="userType">Type of User </label>
		<div>
		<select class="element select medium" id="userType" name="userType">
			<option value="" selected="selected"></option>
            <option value="1" >Student</option>
            <option value="2" >Faculty</option>

		</select>
		</div> 
		</li>
			
					<li class="buttons">
			    <input type="hidden" name="form_id" value="528101" />
			    
				<input id="cancel" class="button_text" type="submit" name="cancel" value="Cancel" />
                <input id="register" class="button_text" type="submit" name="register" value="Register" />
		</li>
			</ul>
		</form>	
		<div id="footer">
			Sharp Cheddar
		</div>
	</div>
	<img id="bottom" src="bottom.png" alt="">
	</body>
</html>